<template>
  <a-collapse-panel>
    <template #header>数据设置</template>
    <a-form-item :name="['chart', 'classifyNameField']" label="分类名称">
      <jnpf-tree-select v-model:value="chart.classifyNameField" lastLevel lastLevelKey="children" :options="dataSetList" :fieldNames="{ value: 'jnpfId' }" />
    </a-form-item>
    <a-form-item :name="['chart', 'seriesNameField']" label="系列名称">
      <jnpf-tree-select v-model:value="chart.seriesNameField" lastLevel lastLevelKey="children" :options="dataSetList" :fieldNames="{ value: 'jnpfId' }" />
    </a-form-item>
    <a-form-item :name="['chart', 'seriesDataField']" label="系列数值">
      <jnpf-tree-select v-model:value="chart.seriesDataField" lastLevel lastLevelKey="children" :options="dataSetList" :fieldNames="{ value: 'jnpfId' }" />
    </a-form-item>
    <a-form-item :name="['chart', 'summaryType']" label="汇总方式">
      <jnpf-select v-model:value="chart.summaryType" :options="summaryTypeOptions" />
    </a-form-item>
  </a-collapse-panel>
</template>

<script lang="ts" setup>
  defineProps(['chart', 'dataSetList']);

  const summaryTypeOptions = [
    { id: 'none', fullName: '无' },
    { id: 'sum', fullName: '合计' },
    { id: 'max', fullName: '最大值' },
    { id: 'min', fullName: '最小值' },
    { id: 'count', fullName: '计数' },
    { id: 'avg', fullName: '平均值' },
  ];
</script>
